# coding=utf-8

from django.contrib import admin

from .models import IDC
from .models import Region
from .models import AZone
from .models import ECS


@admin.register(IDC)
class IDCAdmin(admin.ModelAdmin):
    list_display = ("id", "name", "cn_name", "create_time", "update_time")

    search_fields = ("name", "cn_name")


@admin.register(Region)
class RegionAdmin(admin.ModelAdmin):
    list_display = ("id", "idc", "name", "rid", "status", "create_time", "update_time")

    search_fields = ("name", "idc__name")


@admin.register(AZone)
class AZoneAdmin(admin.ModelAdmin):
    list_display = ("id", "region", "name", "status", "create_time", "update_time")

    search_fields = ("name", "region__name")


@admin.register(ECS)
class ECSAdmin(admin.ModelAdmin):
    list_display = ("id", "idc", "name", "instance_id", "azone", "region",
                    "instance_type", "cpu", "mem", "image", "system",
                    "inner_ip", "pub_ip", "bandwidth",
                    "btype", "vpc", "ctime", "fee_type", "expire_time",
                    "create_time", "update_time")

    search_fields = ("name", "region__name", "idc__name")

